import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;

/**
 * Write a description of class MainMenu here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */

public class MainMenu extends World
{
    public static int stars = 300;
    public static Integer[][] coords = new Integer[2][stars];
    public Play play;

    /**
     * Constructor for objects of class MainMenu.
     * 
     */
    public MainMenu()
    {    
        
        super(1000, 600, 1); 
        
        GreenfootImage i = new GreenfootImage(1000,600);
        i.setColor(Color.BLACK);
        i.fill();
        setBackground(i);
        
        populate();
        //Greenfoot.setWorld(play);
    }
    private void populate(){
    
    for(int x = 0; x < stars; x++){
    coords[0][x] = Greenfoot.getRandomNumber(1000);
    coords[1][x] = Greenfoot.getRandomNumber(600);
    }
    play = new Play();
    for(int x = 0; x < stars; x++){
    addObject(new Star(), coords[0][x] , coords[1][x]);
    }
    addObject(new Button(play, new GreenfootImage("button1.png")), 200,575);
    addObject(new MousePointer(),1,1);
    }
    public void act(){
    int i = Greenfoot.getRandomNumber(30)-19;
    if(i > 5){
        if(i == 6){
            int det = Greenfoot.getRandomNumber(4);
            //Dummy d = new Dummy(new GreenfootImage("bomb.png"));
            Bomb d = new Bomb();
            d.Px = Greenfoot.getRandomNumber(10)-5;
            d.Py = Greenfoot.getRandomNumber(10)-5;
            while(d.Px == 0){
            d.Px = Greenfoot.getRandomNumber(10)-5;
            }
            while(d.Py == 0){
            d.Py = Greenfoot.getRandomNumber(10)-5;
            }
            
            
            
            addObject(d, 450+Greenfoot.getRandomNumber(50), 250+Greenfoot.getRandomNumber(50));
            
            
         
        
        }
        if(i == 7){
            int det = Greenfoot.getRandomNumber(4);
            //Dummy d = new Dummy(new GreenfootImage("bomb.png"));
            Dummy d = new Dummy(new GreenfootImage("player.png"),(double)Greenfoot.getRandomNumber(500)/100);
            d.Px = Greenfoot.getRandomNumber(10)-5;
            d.Py = Greenfoot.getRandomNumber(10)-5;
            while(d.Px == 0){
            d.Px = Greenfoot.getRandomNumber(10)-5;
            }
            while(d.Py == 0){
            d.Py = Greenfoot.getRandomNumber(10)-5;
            }
            addObject(d, 450+Greenfoot.getRandomNumber(50), 250+Greenfoot.getRandomNumber(50));
            
        
        }
        if(i == 8){
            int det = Greenfoot.getRandomNumber(4);
            //Dummy d = new Dummy(new GreenfootImage("bomb.png"));
            Dummy d = new Dummy(new GreenfootImage("Charge.png"),(double)Greenfoot.getRandomNumber(500)/100);
            d.Px = Greenfoot.getRandomNumber(10)-5;
            d.Py = Greenfoot.getRandomNumber(10)-5;
            while(d.Px == 0){
            d.Px = Greenfoot.getRandomNumber(10)-5;
            }
            while(d.Py == 0){
            d.Py = Greenfoot.getRandomNumber(10)-5;
            }
            addObject(d, 450+Greenfoot.getRandomNumber(50), 250+Greenfoot.getRandomNumber(50));
            
        
        }
             if(i == 9){
            int det = Greenfoot.getRandomNumber(4);
            //Dummy d = new Dummy(new GreenfootImage("bomb.png"));
            Dummy d = new Dummy(new GreenfootImage("Tship.png"),(double)Greenfoot.getRandomNumber(500)/100);
            d.Px = Greenfoot.getRandomNumber(10)-5;
            d.Py = Greenfoot.getRandomNumber(10)-5;
            while(d.Px == 0){
            d.Px = Greenfoot.getRandomNumber(10)-5;
            }
            while(d.Py == 0){
            d.Py = Greenfoot.getRandomNumber(10)-5;
            }
            addObject(d, 450+Greenfoot.getRandomNumber(50), 250+Greenfoot.getRandomNumber(50));
            
        
        }
    
             if(i == 10){
            int det = Greenfoot.getRandomNumber(4);
            //Dummy d = new Dummy(new GreenfootImage("bomb.png"));
            Dummy d = new Dummy(new GreenfootImage("HealthCircle.png"),0);
            d.Px = Greenfoot.getRandomNumber(10)-5;
            d.Py = Greenfoot.getRandomNumber(10)-5;
            while(d.Px == 0){
            d.Px = Greenfoot.getRandomNumber(10)-5;
            }
            while(d.Py == 0){
            d.Py = Greenfoot.getRandomNumber(10)-5;
            }
            addObject(d, 450+Greenfoot.getRandomNumber(50), 250+Greenfoot.getRandomNumber(50));
            
        
        }
    
    
    }
    
    }
}
